<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"
	dir="ltr">
<head>
<title>Moment Mobile Payments</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/styles/layout.css" type="text/css" />
	<script>
	function hideform() {

		$('#editprofile').hide();

	}
	function showform() {
		$('#editprofile').show();
		$('#viewprofile').hide();

	}
</script>
</head>

<body id="top" onload="hideform()">
	<%@include file="loggedinheader.jsp"%>
		<%
	
		System.out.println("Session name:="
				+ session.getAttribute("username"));
		if ((session.getAttribute("username") == null)
				|| (session.getAttribute("username") == "")) {
			response.sendRedirect("index.jsp");

		} else {
			String error=(String)session.getAttribute("error");
			System.out.println("Error="+error);
			if(error!=null && !error.equalsIgnoreCase("null")){
				%>
				<div class="alert-box error">
				<span>error: </span><%=error%>
				</div>
				<%
				session.setAttribute("error", null);
			}
			String success=(String)session.getAttribute("success");
			System.out.println("Error="+success);
			if(success!=null && !success.equalsIgnoreCase("null")){
				%>
				<div class="alert-box success">
				<span>success: </span><%=success%>
				</div>
				<%
				session.setAttribute("success", null);
			}
			
	%>
	
	<jsp:useBean id="userObj" class="com.moment.model.UserReg"
		scope="session"></jsp:useBean>
	<jsp:useBean id="walletObj" class="com.moment.model.WalletData"
		scope="session"></jsp:useBean>
	<jsp:useBean id="profileObj"
		class="com.moment.model.ProfileDetailsData" 
		scope="session"></jsp:useBean>
	
	<div class="wrapper col3">

		<div id="intro">
			<div id="logout">
				<a href="/MMP/LogoutController"><img src="<%=request.getContextPath()%>/images/logout.png"
					alt="Logout" /></a>
			</div>
			
			
			<div class="fl_left1">
				<div id="login1">
					<div class="imgl">
						<img alt="IMAGE" height="128" width="128"
							src="data:image/jpeg;base64,<jsp:getProperty name="userObj" property="imagestr" />" />
					</div>
					
 				
				</div>
				<div id="instrumentsmain">
				<center>
							<h2>
								Edit Profile
								
							</h2>
						</center>
			
				<form action="../ProfileController" method="post" enctype="multipart/form-data" id="editprofile">

					<table>
					<tr>
					<td>Select Image</td>
					<td><input type="file" name="img" /> </td>
	</tr>
						<tr>
							<td>Name:</td>
							<td><input type="text" name="name"
								value="<%=userObj.getName()%>" /></td>
						</tr>
						<tr>
							<td>Address:</td>


							<td><textarea id="address" name="address" rows="4" cols="30" /><%=profileObj.getAddr()%>
								</textarea></td>
						</tr>

						<tr>
							<td>Wallet limits:</td>
						</tr>
						<tr>
							<td>Geolimits-</td>
							<td><input type="text" name="geolimit"
								value="<%=profileObj.getGeolimit()%>" /></td>
						</tr>
						<tr>
							<td>Dailylimits-</td>
							<td><input type="text" name="dlimit"
								value="<%=walletObj.getWdlimit()%>" /></td>
						</tr>
						<tr>
							<td>Monthlylimits-</td>
							<td><input type="text" name="mlimit"
								value="<%=walletObj.getWmlimit()%>" /></td>
						</tr>
					</table>
					<input type="hidden" name="updateorsave" value="update"/>
					<div class="fl_right">
						<input type="submit" class="myButton" value="Submit" />
					</div>
				</form>





<form  id="viewprofile">

					<table>

						<tr>
							<td>Name:</td>
							<td><%=userObj.getName()%></td>
						</tr>
						<tr>
							<td>Address:</td>


							<td><%=profileObj.getAddr()%>
								</td>
						</tr>

						<tr>
							<td>Wallet limits:</td>
						</tr>
						<tr>
							<td>Geolimits-</td>
							<td><%=profileObj.getGeolimit()%></td>
						</tr>
						<tr>
							<td>Dailylimits-</td>
							<td><%=walletObj.getWdlimit()%></td>
						</tr>
						<tr>
							<td>Monthlylimits-</td>
							<td><%=walletObj.getWmlimit()%></td>
						</tr>
					</table>
					<div class="fl_right">
						<input type="button" class="myButton" 
							 value="Edit" onclick="showform()" />
					</div>
				</form>
<%} %>


			</div>
			</div>
		</div>
	</div>
	<br class="clear" />
	</div>
	<%@include file="footer.jsp"%>
	</div>

</body>
</html>

<script src="//code.jquery.com/jquery-1.9.1.js"></script>

